home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dirut
/
dirm13.zip
/
DIRM13.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-11-02
|
48KB
|
1,272 lines
;-----------------------------------------------------------------------;
; This is the main source code for DIRM v1.3, a FAST! directory lister. ;
; It is the copyrighted property of Michael P. Rice. (c) 1990. ;
; This source code is NOT in the public domain and cannot be used ;
; commercially without permission. Completed 2-November-1990. ; ;
;-----------------------------------------------------------------------;
.model small
.data
;-----------------------------------------------------------------------;
; The following table is used in the write_time procedure. The bits ;
; are used as follows: Bits 6,7 Unused ;
; 5 Space flag 0=off 1=on ;
; 4 Am\Pm flag 0=am 1=pm ;
; 3,2,1,0 Hour to print ;
;-----------------------------------------------------------------------;
time_table db 0ch,21h,22h,23h,24h,25h,26h,27h,28h,29h,0ah,0bh
db 1ch,31h,32h,33h,34h,35h,36h,37h,38h,39h,1ah,1bh
;-----------------------------------------------------------------------;
; This is a simple table to determine AM/PM for write_time. ;
;-----------------------------------------------------------------------;
am_pm_table db 'a','p'
def_filespec db '*.*',0
volumespec db '*.*',0
filespec db 13 dup (0)
filespec2 db 13 dup (0) ; SS
;-----------------------------------------------------------------------;
; These are used for attribute processing. Default is attributes will ;
; not be printed. File mask 31h means hidden and system files are not ;
; show in the directory. When attributes are on, system and hidden ;
; files are shown with mask=37h ;
;-----------------------------------------------------------------------;
attrib_on db 0
attrib_mask dw 0031h
;-----------------------------------------------------------------------;
; These are the ASCIIZ string data messages used in the program. ;
;-----------------------------------------------------------------------;
volumemess1 db 'Volume in Drive ',0
volumemess2 db ' is ',0
volumemess3 db ' has no label.',0
colon db ':',0 ;SS
dirmess1 db "DIRM v1.3 Directory of ",0
dirmess2 db ' Filespec: ',0
dir_braces db ' <DIR> ',0
moremessage db 'Press any key to continue',0
trailermess0 db ' bytes in ',0
trailermess1 db ' File(s)',0
trailermess2 db ' bytes free. ',0
illegalswitch db 'Usage: dirm [d:][path specification] [/switches]',0
legalswitches db ' /w wide mode /p page at a time /a show attribs',0
nofoundpath db 'Unknown Path | ',0
nofoundswitch db 'Illegal Switch | ',0
;-----------------------------------------------------------------------;
; Flags used to indicate the use of a switches /p /w /r. ;
;-----------------------------------------------------------------------;
page_flag db 0
recursive_flag db 0
wide_flag db 0
;-----------------------------------------------------------------------;
; Flags used in PSP processing to detect the need for default params. ;
;-----------------------------------------------------------------------;
drive_set db 0
directory_set db 0
;-----------------------------------------------------------------------;
; This is used to keep a count of the files in the directory, not ;
; including directory entries. ;
;-----------------------------------------------------------------------;
files dw 0
;-----------------------------------------------------------------------;
; This keeps track of lines printed for the /p page switch. It is set ;
; initially to 3 to keep the header on the screen. ;
;-----------------------------------------------------------------------;
filecount db 3
;-----------------------------------------------------------------------;
; These are where the drive numbers are stored when a change is needed. ;
;-----------------------------------------------------------------------;
startdrive db 0
tempdrive db 0
;-----------------------------------------------------------------------;
; These are directory specifications used with INT 21h BIOS calls. ;
;-----------------------------------------------------------------------;
root db '\',0
directory db '\'
db 64 dup (?)
tempdir db '\'
db 64 dup (?)
;-----------------------------------------------------------------------;
; This is where the filesizes of matching files are accumulated. ;
;-----------------------------------------------------------------------;
accum_filesize dd 00000000h
;-----------------------------------------------------------------------;
; This is the field to add commas to the filesize, bytes free numbers ;
;-----------------------------------------------------------------------;
p_field db ' , , , ',0
.data?
;-----------------------------------------------------------------------;
; This is the data area used for the disk DTA - Disk Transfer Area. ;
;-----------------------------------------------------------------------;
Reserved db 21 dup (?) ;Reserved
FAttrib db 1 dup (?) ;file's Attribute
FTime db 2 dup (?) ;file's time stamp
FDate db 2 dup (?) ;file's date stamp
FSize db 4 dup (?) ;file's size
FName db 13 dup (?) ;ASCIIZ file name
;-----------------------------------------------------------------------;
; Area to move the command line PSP area switches, directory specs, etc ;
;-----------------------------------------------------------------------;
PSPBytes db 1 dup (?)
PSPSpace db 1 dup (?)
PSPArea db 7Eh dup (?)
;-----------------------------------------------------------------------;
; Just what it says: holds the current filesize that will be added to ;
; the accumulated file size. ;
;-----------------------------------------------------------------------;
current_filesize db 4 dup (?)
.stack
.code
EXTRN send_crlf:proc, write_string:proc, write_char:proc
EXTRN goto_xy:proc, init_write_char:proc
EXTRN SCREEN_X:byte, goto_col:proc
PUBLIC disk_dir
;-----------------------------------------------------------------------;
; This is a C callable function to display a disk directory. ;
;-----------------------------------------------------------------------;
disk_dir PROC
mov dx,ds
mov ax,@data
mov ds,dx ;Both DS and ES point to the data
mov es,ax
mov si,80h ;Move the PSP into Memory
mov di,OFFSET PSPBytes
mov cx,80h
rep movsb
mov ds,ax
call init_write_char ;Determine screen memory
mov ah,19h
int 21h ;Get current drive
mov startdrive,al ;Save current drive
mov tempdrive,al
call process_psp ;Process command switches
call adjust_filespec ;Make filespec = filespec.*
mov ah,47h ;Save the new temporary directory
mov si,OFFSET tempdir+1
mov dl,0
int 21h
call send_crlf
mov dx,OFFSET Reserved ;Set up a DTA
mov ah,1ah
int 21h
call write_volume ;Write Volume Message/Volume
call send_crlf